package com.study.samsung.Service.htService;

import com.study.samsung.Dao.htDao.UserDao;
import com.study.samsung.Entity.User;
import com.study.samsung.Entity.htEntity.Admin;
import com.study.samsung.Utils.Pager;

import java.util.List;

public class UserService {
    UserDao usd = new UserDao();

    public Integer selectByLogin(Admin admin){
        Admin a = usd.selectByLogin(admin.getAdminaccount());

        if (a==null){
            return -2;
        }else {
            if (a.getAdminpwd().equals(admin.getAdminpwd())){
                admin.setAdminid(a.getAdminid());
                admin.setAdminaccount(a.getAdminaccount());
                admin.setAdminpwd(a.getAdminpwd());
                admin.setAdminstate(a.getAdminstate());
                return 1;
            }else {
                return -1;
            }
        }
    }

    public List<User> selectAllUser() {
        return usd.selectAllUser();
    }

    public Pager rainbow(Integer pageNo, Integer pageSize,String inputvalue) {
        return usd.rainbow(pageNo,pageSize,inputvalue);
    }

    public Integer updateStop(Integer uid) {
        return usd.updateStop(uid);
    }

    public Integer updateStart(Integer uid) {
        return usd.updateStart(uid);
    }

    public Integer resetImg(Integer uid) {
        return usd.resetImg(uid);
    }
}
